﻿package src.game{
	import flash.display.MovieClip;

	public class Ball extends MovieClip{
		private var horizontalMovement:Number = 0.0;
		private var verticalMovement:Number = 0.0;
		private var velocity:Number = 4;
		
		public function Ball() {
			// constructor code
		}
		
		public function setMoveDown():void {
			verticalMovement = 1;
		}
		
		public function setMoveUp():void {
			verticalMovement = -1;
		}
		
		public function setVerticalMovement(move:Number):void {
			verticalMovement = move;
		
		}
		public function setMoveRight():void {
			horizontalMovement = 1;
		}
		
		public function setMoveLeft():void {
			horizontalMovement = -1;
		}
		
		public function setHorizontalMovement(move:Number) {
			horizontalMovement = move;
		}
		
		public function getHorizonalMovement():Number {
			return horizontalMovement;
		}
		
		public function getVerticalMovement():Number {
			return verticalMovement;
		}
		
		public function move():void {
			this.x += velocity * horizontalMovement;
			this.y += velocity * verticalMovement;
		}
		
		public function bounce():void {
			this.x += 1 * horizontalMovement;
			this.y += 1 * verticalMovement;
		}
		
		public function toggleHorizontal():void {
			horizontalMovement *= -1;
		}
		
		public function toggleVertical():void {
			verticalMovement *= -1;
		}
		
		public function isMovingLeft():Boolean {
			return (horizontalMovement < 0) ? true : false;
		}
		
		public function speedUp():void {
			velocity *= 2;
		}
		
		public function slowDown():void {
			velocity /= 2;
		}
		
		public function setVelocity(vel:Number):void {
			velocity = vel;
		}
		
		public function getVelocity():Number {
			return velocity;
		}
	}
}
